home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / faq / preak.zip / JAKPOT.ZIP / CRKIBMSW < prev    next >
Text File  |  1988-12-22  |  7KB  |  164 lines

  1.                     ****************************************
  2.                     *                                      *
  3.                     *        Cracking On the IBMpc         *
  4.                     *               Part I                 *
  5.                     *                                      *
  6.                     ****************************************
  7.  
  8. Introduction
  9. ------------
  10.   For years, I have seen cracking tutorials for the APPLE computers, but never
  11. have I seen one for the PC.  I have decided to try to write this series to help
  12. that pirate move up a level to a crackest.
  13.  
  14.   In this part, I will cover what happens with INT 13 and how most copy
  15. protection schemes will use it.  I strongly suggest a knowledge of Assembly
  16. (M/L) and how to use DEBUG.  These will be an important figure in cracking
  17. anything.
  18.  
  19. INT-13 - An overview
  20. --------------------
  21.   Many copy protection schemes use the disk interrupt (INT-13).  INT-13 is
  22. often use to either try to read in a illegaly formatted track/sector or to
  23. write/format a track/sector that has been damaged in some way.  INT-13 is
  24. called like any normal interrupt with the assembler command INT 13 (CD 13).
  25. [AH] is used to select which command to be used, with most of the other
  26. registers used for data.
  27.  
  28. INT-13 Cracking Collage
  29. -----------------------
  30.   Although, INT-13 is used in almost all protection schemes, the easiest to
  31. crack is the DOS file.  Now the protected program might use INT-13 to load some
  32. other data from a normal track/sector on a disk, so it is important to
  33. determine which tracks/sectors are important to the protection scheme.  I have
  34. found the best way to do this is to use LOCKSMITH/pc (what, you don't have LS.
  35. Contact your local pirate for it.) Use LS to analyze the diskette.  Write down
  36. any track/sector that seems abnormal.  These track are must likely are part of
  37. the protection routine.  Now, we must enter debug. Load in the file execute a
  38. search for CD 13.  Record any address show.  If no address are picked up, this
  39. mean 1 or 2 things, the program is not copy protected (bullshit) or that the
  40. check is in an other part of the program not yet loaded.  The latter
  41. being a real bitch to find, so I'll cover it in part II.  There is another
  42. choice.  The CD 13 might be hidden in self changing code.  Here is what a
  43. sector of hidden code might look like
  44.  
  45. -U CS:0000
  46. 1B00:0000 31DB     XOR    BX,BX
  47. 1B00:0002 8EDB     MOV    DS,BX
  48. 1B00:0004 BB0D00   MOV    BX,000D
  49. 1B00:0007 8A07     MOV    AL,[BX]
  50. 1B00:0009 3412     XOR    AL,12
  51. 1B00:000B 8807     MOV    [BX],AL
  52. 1B00:000D DF13            FIST   WORD...
  53.  
  54.   In this section of code, [AL] is set to DF at location 1B00:0007.  When you
  55. XOR DF and 12, you would get a CD(hex) for the INT opcode which is placed right
  56. next to a 13 ie, giving you CD13 or INT- 13.  This type of code can't and will
  57. not be found using debug's [S]earch command.
  58.  
  59. Finding Hidden INT-13s
  60. ----------------------
  61.   The way I find best to find hidden INT-13s, is to use a program called PC-
  62. WATCH (TRAP13 works well also).  This program traps the interrupts and will
  63. print where they were called from.  Once running this, you can just disassemble
  64. around the address until you find code that look like it is setting up the disk
  65. interrupt.
  66.   An other way to decode the INT-13 is to use debug's [G]o command.  Just set a
  67. breakdown at the address give by PC-WATCH (both programs give the return
  68. address).  Ie, -G CS:000F (see code above).  When debug stops, you will have
  69. encoded not only the INT-13 but anything else leading up to it.
  70.  
  71. What to do once you find INT-13
  72. -------------------------------
  73.   Once you find the INT-13, the hard part for the most part is over.  All that
  74. is left to do is to fool the computer in to thinking the protection has been
  75. found.  To find out what the computer is looking for, examine the code right
  76. after the INT-13.  Look for any branches having to do with the CARRY FLAG or
  77. any CMP to the AH register.  If a JNE or JC (etc) occurs, then [U]nassembe the
  78. address listed with the jump.  If it is a CMP then just read on.  Here you must
  79. decide if the program was looking for a protected track or just a normal track.
  80. If it has a CMP AH,0 and it has read in a protected track, it can be assumed
  81. that it was looking to see if the program had successfully complete the
  82. READ/FORMAT of that track and that the disk had been copied thus JMPing back to
  83. DOS (usually).  If this is the case, Just NOP the bytes for the CMP and the
  84. corresponding JMP.  If the program just checked for the carry flag to be set,
  85. and it isn't, then the program usually assumes that the disk has been copied.
  86. Examine the following code
  87.  
  88.       INT 13      <-- Read in the Sector
  89.       JC 1B00     <-- Protection found
  90.       INT 19      <-- Reboot
  91. 1B00  (rest of program)
  92.  
  93.   The program carries out the INT and find an error (the illegaly formatted
  94. sector) so the carry flag is set.  The computer, at the next instruction, see
  95. that the carry flag is set and know that the protection has not been breached.
  96. In this case, to fool the computer, just change the "JC 1B00" to a "JMP 1B00"
  97. thus defeating the protection scheme.
  98.  
  99.  
  100. NOTE: the PROTECTION ROUTINE might be found in more than just 1 part of the
  101.      program
  102.  
  103. Handling EXE files
  104. ------------------
  105.   As we all know, Debug can read .EXE files but cannot write them.  To get
  106. around this, load and go about cracking the program as usual.  When the
  107. protection scheme has been found and tested, record (use the debug [D]ump
  108. command) to save + & - 10 bytes of the code around the INT 13.  Exit back to
  109. dos and rename the file to a .ZAP (any extension but .EXE will do) and
  110. reloading with debug.  Search the program for the 20+ bytes surrounding the
  111. code and record the address found.  Then just load this section and edit it
  112. like normal.  Save the file and exit back to dos.  Rename it back to the .EXE
  113. file and it should be cracked.  ***NOTE: Sometimes you have to fuck around for
  114. a while to make it work.
  115.  
  116. DISK I/O (INT-13)
  117. -----------------
  118.   This interrupt uses the AH resister to select the function to be used.  Here
  119. is a chart describing the interrupt.
  120.  
  121. AH=0    Reset Disk
  122. AH=1    Read the Status of the Disk
  123.         system in to AL
  124.  
  125.     AL          Error
  126.   ----------------------------
  127.     00   - Successful
  128.     01   - Bad command given to INT
  129.    *02   - Address mark not found
  130.     03   - write attempted on write prot
  131.    *04   - request sector not found
  132.     08   - DMA overrun
  133.     09   - attempt to cross DMA boundary
  134.    *10   - bad CRC on disk read
  135.     20   - controller has failed
  136.     40   - seek operation failed
  137.     80   - attachment failed
  138. (* denotes most used in copy protection)
  139. AH=2    Read Sectors
  140.  
  141.   input
  142.      DL = Drive number (0-3)
  143.      DH = Head number (0or1)
  144.      CH = Track number
  145.      CL = Sector number
  146.      AL = # of sectors to read
  147.   ES:BX = load address
  148.   output
  149.       AH =error number (see above)
  150.           [Carry Flag Set]
  151.       AL = # of sectors read
  152.  
  153. AH=3 Write (params. as above)
  154. AH=4 Verify (params. as above -ES:BX)
  155. AH=5 Format (params. as above -CL,AL
  156.              ES:BX points to format
  157.              Table)
  158.  
  159.   For more information on INT-13 see the IBM Technical Reference Manuals.
  160.  
  161. Coming Soon
  162. ------------
  163.   In part II, I will cover CALLs to INT-13 and INT-13 that is located in
  164. different overlays of the program